# 判断某年某天
# 输入某年某月某日，判断这一天是这一年的第几天。

# 基础 内置函数

# 使用datetime内置日期计算库

import datetime

year, month, day = [int(x) for x in input().split(' ')]

yuandan = datetime.datetime(year, 1, 1)
now = datetime.datetime(year, month, day)
print((now-yuandan).days + 1)

# 使用传统的判断和计算
lis1 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
lis2 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def leap_common(year):
    if year % 100 == 0 and year % 400 == 0:
        return True
    if year % 100 != 0 and year % 4 == 0:
        return True
    return False

def calc_day(year, month, day):
    days = day
    month -= 1
    for i in range(1, month):
        if i == 2:
            if leap_common(year):
                days += sum(lis1[:month])
            else:
                days += sum(lis2[:month])
    return days

days = calc_day(year, month, day)

print(days)
